<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
<!--computed:中声明的是方法属性,不可与data的变量重复-->
<div id="app">

    <p @click="change_num">{{num}}</p>
    <p>十位:{{parseInt(num / 10)}}</p>
    <p>个位:{{num % 10}}</p>


    <hr>
    <input type="text" v-model="shi">
    <input type="text" v-model="ge">
    结果:    <p>{{shi*10+ +ge}}</p>
    <hr>
    <input type="number" v-model="shi" max="9" min="0">
    <input type="number" v-model="ge" max="9" min="0">
    结果: {{result}}
</div>

<script>
    new Vue({
        el: "#app",
        data: {
            num: 30,
            shi: "",
            ge: "",
        },
        methods:{
            change_num(){
                this.num++;
            },
        },
        computed:{
            result(){
                console.log(this)
                return this.shi*10 + +this.ge;
            }
        }
    })
</script>

</body>
</html>